package com.mademoisellegeek.carrentalsimulation.comparator;

import com.mademoisellegeek.carrentalsimulation.Travel;
import com.mademoisellegeek.carrentalsimulation.Travel;
import java.util.Comparator;

/*
 * Comparator corresponding to the START_DATE sort method
 */
public class StartDayComparator implements Comparator {

    @Override
    public int compare(Object travel1, Object travel2) {

        int startDay1 = ((Travel) travel1).getStartDay();
        int startDay2 = ((Travel) travel2).getStartDay();

        if (startDay1 > startDay2) {
            return 1;
        } else if (startDay1 < startDay2) {
            return -1;
        } else {
            return 0;
        }
    }
}